#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<stdlib.h>
#include<unistd.h>


int main()
{
    int fd=open("test.txt",O_WRONLY|O_CREAT|O_TRUNC,0666);
    if(fd<0)
    {
        perror("open");
        exit(-1);
    }
    
    write(fd,"hello linux",11);

    int n=lseek(fd,0,SEEK_END);
    printf("%d\n",n);
    close(fd);



    return 0;
}
